export default {
  namespaced: true,
  state: {
    //主题对应颜色
    colors: [
      {
        name: '蓝色主题',
        color: '#346c9c',
      },
      {
        name: '绿色主题',
        color: '#1ba784',
      },
      {
        name: '红色主题',
        color: '#ec2d7a',
      },
      {
        name: '黑色主题',
        color: '#000',
      },
      {
        name: '灰色主题',
        color: '#545c64',
      },
    ],
    //当前主题
    currentTheme: JSON.parse(localStorage.getItem('theme')) || {
      name: '蓝色主题',
      color: '#346c9c',
    },
  },
  getters: {
    //生成颜色名数组
    getColorNames(state){
      return state.colors.map(obj => obj.name);
    },
  },
  mutations: {
    //更新当前主题
    updateCurTheme(state, newTheme){
      state.currentTheme = newTheme;
    },
  },
  actions: {
  },
}